<template>
	<view class="pr">
		<view class="nav"></view>
		<view class="pa0 w100">
			<view class="m2432 ">
				<view class="flex btw">
					<view class="flex flex1">
						<image class="img120 br50" :src="user.avatar" mode="">
						</image>
						<view class="pt12 ml20 flex1">
							<view class="sn1 cf fw600 fs36">{{user.nickname}}</view>
							<view class="mt18 cf fw500 fs28">{{user.state == 'normal'?'上班中':'休息中'}}</view>
						</view>
					</view>
					<view class="mt12 ml20">
						<image class="img50" @click="saoCode" src="/static/my/PickPerson/sm.png" mode=""></image>
					</view>
				</view>

				<view class="mt40 bgf br12 menu flex_btw">
					<view class="">
						<view class="c2a7 fw600 fs36 tc">￥{{pickPerson_data.month_revenue}}</view>
						<view class="c3 fw500 fs28 mt12 tc">本月收入</view>
					</view>
					<view class="verticalBar mlr30"></view>
					<view class="">
						<view class="c2a7 fw600 fs36 tc">{{pickPerson_data.today_order_num}}</view>
						<view class="c3 fw500 fs28 mt12 tc">今日配送订单</view>
					</view>
					<view class="verticalBar mlr30"></view>
					<view class="">
						<view class="c2a7 fw600 fs36 tc">{{pickPerson_data.order_num}}</view>
						<view class="c3 fw500 fs28 mt12 tc">累计配送订单</view>
					</view>
				</view>

				<view class="mt24 bgf br12">
					<view class="flex_btw p3024" @click="toPath(1)">
						<view class="flex_x">
							<image class="img32" src="/static/my/PickPerson/gzzt.png" mode=""></image>
							<view class="ml20 c3 fs30">工作状态</view>
						</view>
						<view class="">
							<u-icon name="arrow-right" color="#747474" size="26rpx"></u-icon>
						</view>
					</view>
					<view class="cut_line"></view>
					<view class="flex_btw p3024" @click="toPath(2)">
						<view class="flex_x">
							<image class="img32" src="/static/my/PickPerson/jjmx.png" mode=""></image>
							<view class="ml20 c3 fs30">佣金明细</view>
						</view>
						<view class="">
							<u-icon name="arrow-right" color="#747474" size="26rpx"></u-icon>
						</view>
					</view>
					<view class="cut_line"></view>
					<view class="flex_btw p3024" @click="toPath(3)">
						<view class="flex_x">
							<image class="img32" src="/static/my/PickPerson//wdzl.png" mode=""></image>
							<view class="ml20 c3 fs30">我的资料</view>
						</view>
						<view class="">
							<u-icon name="arrow-right" color="#747474" size="26rpx"></u-icon>
						</view>
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapState
	} from 'vuex';

	export default {
		components: {},
		data() {
			return {
				pickPerson_data: { //数据统计
					month_revenue: 0,
					order_num: 0,
					today_order_num: 0,
				},
			}
		},
		methods: {
			pickPickings() { //取货员数据统计
				this.$api.pickPickings().then(res => {
					if (res.code == 1) {
						this.pickPerson_data = res.data
					}
				})
			},
			toPath(e) { //菜单跳转
				if (e == 1) {
					uni.navigateTo({
						url: '/pages/PickPerson/my/workState/workState?type=1'
					})
				} else if (e == 2) {
					uni.navigateTo({
						url: '/pages/PickPerson/my/brokerageDetail/brokerageDetail'
					})
				} else if (e == 3) {
					uni.navigateTo({
						url: '/pages/PickPerson/my/myData/myData'
					})
				}
			},
			saoCode() { //扫码
				uni.scanCode({
					success: (res) => {
						// console.log(res, res.result)
						this.orderInfo(res.result)
					}
				});
			},
			orderInfo(e) { //订单详情
				this.$api.orderInfo({
					sn: e
				}).then(res => {
					if (res.code == 1) {
						if (res.data) {
							uni.navigateTo({
								url: `/pages/PickPerson/index/orderDetails/orderDetails?type=-1&sn=${e}`
							})
						} else {
							uni.$u.toast('订单不存在')
						}
					} else {
						uni.$u.toast(res.msg)
					}
				})
			}
		},
		computed: {
			...mapState({
				user: state => state.userInfo,
			}),
		},
		watch: {

		}
	}
</script>

<style lang="scss" scoped>
	.nav {
		height: 315upx;
		background-color: #2479D8;
		border-radius: 0 0 540rpx 540rpx/0 0 80rpx 80rpx;
		border-top: 1upx solid rgba(0, 0, 0, 0.1);
	}

	.menu {
		padding: 38upx 32upx;
		box-shadow: 0px 3upx 6upx 0px rgba(14, 14, 14, 0.15);
	}

	.verticalBar {
		width: 1upx;
		height: 60upx;
		background: #333333;
	}
</style>
